/*
 * @Author: hua
 * @Date: 2020-07-17 17:03:32
 * @description: 
 * @LastEditors: hua
 * @LastEditTime: 2020-09-29 17:45:27
 */
import Vue from 'vue'
import Router from 'vue-router'
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  { path: '/404', component: () => import('@/views/404'), hidden: true },
  /* { path: '/', component: () => import('@/views/demo/print'), hidden: true }, */
  { path: '/', component: () => import('@/views/login/index'), hidden: true },
  {
    path: '/auth/',
    component: Layout,
    meta: { title: 'Auth', icon: 'table' },
    hidden: true,
    children: [
      {
        path: 'modifyPassword',
        name: "modifyPassword",
        component: () => import('@/views/modifyPassword/index'),
        meta: { title: 'UpdatePasswordScreen', icon: 'table' }
      },
      {
        path: 'chooseProductionPlan',
        name: "chooseProductionPlan",
        component: () => import('@/views/chooseProductionPlan/index'),
        meta: { title: 'ChooseProductionPlanScreen', icon: 'table' }
      }

    ]
  },
  {
    path: '/setting',
    component: Layout,
    name: 'Setting',
    hidden: false,
    meta: { title: 'setting', icon: 'table' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/setting/index'),
        meta: { title: 'setting', icon: 'table' }
      }
    ]
  },
  {
    path: '/dashboard',
    component: Layout,
    name: 'Dashboard',
    hidden: false,
    children: [
      {
        path: 'index',
        component: () => import('@/views/dashboard/index'),
        meta: { title: 'Dashboard', icon: 'table' }
      }
    ]
  },
  {
    path: "/bindEquipment",
    component: Layout,
    name: "bindEquipment",
    meta: { title: 'bindEquipment', icon: 'table' },
    redirect: '/bindEquipment/index',
    children: [{
      path: 'index',
      name: 'behindCode',
      component: () => import('@/views/bindEquipment/index'),
      meta: { title: 'bindBehindCode', icon: 'table' }
    },
    {
      path: 'bindBox',
      name: 'bindBox',
      component: () => import('@/views/bindEquipment/bindBox'),
      meta: { title: 'bindBox', icon: 'table' }
    },
    {
      path: 'bindTransportBox',
      name: 'bindTransportBox',
      component: () => import('@/views/bindEquipment/bindTransportBox'),
      meta: { title: 'bindTransportBox', icon: 'table' }
    }, {
      path: 'table',
      name: 'behindCodeTable',
      component: () => import('@/views/bindEquipment/table'),
      meta: { title: 'table', icon: 'table' }
    }
    ]
  },
  {
    path: "/equipmentExam",
    component: Layout,
    name: "equipmentExam",
    meta: { title: 'equipmentExam', icon: 'table' },
    redirect: '/equipmentExam/index',
    children: [{
      path: 'index',
      name: 'entireLockExam',
      component: () => import('@/views/equipmentExam/index'),
      meta: { title: 'entireLockExam', icon: 'table' }
    },
    {
      path: 'batteryBoxExam',
      name: 'batteryBoxExam',
      component: () => import('@/views/equipmentExam/batteryBoxExam'),
      meta: { title: 'batteryBoxExam', icon: 'table' }
    }
    ]
  },
  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

